Skip to main content

createAnimationInstance

Type

function

Summary

Creates an animation instance from a defined animation.

Syntax

createAnimationInstance(<pTargetControl>, <pAnimationName>, [<pOptions>])

Description

Creates an instance of a keyframe animation that can be played on a target control. The animation instance is based on a previously defined animation (using defineAnimation). pOptions can be used to modify playback parameters like looping, direction, delays, and playback speed. The returned ID can be used to control the animation instance using startAnimation, stopAnimation, and pauseAnimation.

Parameters

NameTypeDescription

pTargetControl

The long id of the control to apply the animation to.

pAnimationName

The name of the animation definition (created with defineAnimation).

pOptions

An array of options to customize the animation instance. Possible keys include:

  • loop (number/boolean): Number of times to loop the animation (default: 1). Use true or 0 for infinite looping.
  • direction (string): "normal", "reverse", or "alternate" (default: "normal").
  • autoPlay (boolean): Whether to start the animation automatically (default: true).
  • delay (number): Delay in seconds before starting the animation (default: 0).
  • endDelay (number): Delay in seconds after the animation ends (default: 0).
  • speed (number): Playback speed multiplier (e.g., 2 for double speed, 0.5 for half speed) (default: 1).
  • initialKeyframe (number): The initial keyframe percentage to start the animation from (default: 0). This allows starting the animation from a point other than the beginning.

Examples

local tAnimationID
put createAnimationInstance(the long id of button "Target", "myAnimation") into tAnimationID
if "error" is not in tAnimationID then
startAnimation tAnimationID
end if

Compatibility and Support

OS

mac

windows

linux

ios

android

Platforms

desktop

mobile

web